<template>
    <div>
        <Modal title="打印机设置" v-model="show" @on-visible-change="showModal" :closable="false" :mask-closable="false">
            <el-form ref="searchKeyForm"  :model="searchKeyInfo">
                <el-form-item  prop="printer" style="margin-bottom: 15px;width: 100%">
                        <el-select style="display:block" v-model="searchKeyInfo.printer" placeholder="选择打印机">
                            <el-option v-for="(pt,ind) in printers"  :key="ind" :label="pt.name" :value="pt.name"></el-option>
                            
                        </el-select>
                    </el-input>
                </el-form-item>
            </el-form>
            <div slot="footer">
                <el-button @click="cancelAsync">取消</el-button>
                <el-button type="primary" @click="okAsync">保存</el-button>
            </div>
        </Modal>
    </div>
</template>
<script>
export default {
    name: "CAsync",
    data() {
        return {
            searchKeyInfo:{
                printer:"",
            }
        }
    },
    props: [
        "show", "printers","defaultPrinter"
    ],
    mounted: function() {

    },
    watch: {

    },
    methods: {
        showModal: function(val) {
            if(val)
            {
                this.searchKeyInfo.printer=this.defaultPrinter;
            }
        },
        cancelAsync: function(argument) {
            // body...
            this.$emit("cancel")
        },
        okAsync: function(argument) {
            this.$emit("ok",this.searchKeyInfo.printer);
        }
    }
}
</script>